<!DOCTYPE >
<html xmlns:th="http://www.thymeleaf.org" lang="ch">
<head>
    <base th:href="@{/}">
    <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" type="text/css" href="../static/register.css">
    <title>惠院选课系统</title>
</head>
<body>
<div id="title">
    惠院选课系统
</div>
<div id="content">
    <h1 >管理员登录</h1><br />
<!--    <form action="/register" method="post" >-->
<!--        身份：<input type="text" name="identity" id="identity" list="typelist" placeholder="请选择身份" />-->
<!--        <datalist id="typelist">-->
<!--            <option>学生</option>-->
<!--            <option>教师</option>-->
<!--        </datalist><br /><br />-->
        帐号：<input type="text" name="userid" id="userid" placeholder="请输入账号" /><br /><br />
        密码：<input type="password" name="password" id="password" placeholder="请输入密码" /><br /><br />
<!--        确认：<input type="password2" name="password2" id="password2" placeholder="请确认密码" /><br /><br />-->
        <input type="button" name="register" id="register" value="登录" onclick="btn()"/>
<!--        <a href="login.html" target="_blank">-->
<!--            <p><span class="return">已有账号，返回登录</span></p></a>-->
<!--    </form>-->
</div>
</body>
<script>
    function btn() {
        var ID = document.getElementById("userid").value;
        var password = document.getElementById("password").value;
        $.ajax({
            url:"/admin/mlogin",
            type:"GET",
            data:{
                ID:ID,
                psw:password,
            },
            success:function (msg) {
                if(msg=="id") alert("账号不能为空！！！");
                else if(msg=="psw") alert("密码不能为空！！！");
                else if(msg=="error") alert("账号密码错误！！！");
                else if(msg=="yes") {
                    alert("登录成功！！！");
                    window.open("/admin/getAllteacher","_self");
                }
            },
            error:function (error) {
                alert("请检查网络连接！");
            }
        })

    }
</script>
<script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js" integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" crossorigin="anonymous"></script>
<script>window.jp || document.write('<script src="https://cdn.jsdelivr.net/npm/@bootcss/v3.bootcss.com@1.0.24/assets/js/vendor/jquery.min.js"><\/script>')</script>
</html>
